#ifndef __Collections_GenericComparer_H__
#define __Collections_GenericComparer_H__

///<summary>
/// GenericComparer<T>
///</summary>
//+ requires: System_IComparable(T)
#define Collections_GenericComparer(T) bindT(Collections_GenericComparer,T)
#define Declare_Collections_GenericComparer(T, Ti) \
	/* where T : System_IComparable(T) */ \
	public classT(Collections_GenericComparer,T,Collections_Comparer(T),, \
	); \
	Declare_DefaultCtorT(public,Collections_GenericComparer,T)
#define Implement_Collections_GenericComparer(T, Ti) \
	/* [ Compare ] */ \
	private_ int_ spaceT(_cgc_,T,Compare)(Collections_GenericComparer(T) *t, Ti x, Ti y) \
    { \
        if (x != nullT(Ti)) \
        { \
            if (y != nullT(Ti)) \
            { \
                return vcallT(System_IComparable,T,__boxT(Ti,x),CompareTo, y); \
            } \
            return 1; \
        } \
        if (y != nullT(Ti)) \
        { \
            return -1; \
        } \
        return 0; \
    } \
	/* [ Equals ] */ \
    private_ bool spaceT(_cgc_,T,Equals)(Collections_GenericComparer(T) *t, System_Object *obj) \
    { \
        Collections_GenericComparer(T) *comparer = as(obj, Collections_GenericComparer(T)); \
        return (comparer != null); \
    } \
	\
	/* [ GetHashCode ] */ \
    private_ int_ spaceT(_cgc_,T,GetHashCode)(Collections_GenericComparer(T) *t) \
    { \
        return string_getHashCode(space(System_Object,GetType)(base)->Name); \
    } \
	Implement_TypeT(Collections_GenericComparer,T,Collections_Comparer(T), \
		/*TODO*/ \
	) \
	Implement_DefaultCtorT(Collections_GenericComparer,T,Collections_Comparer(T))

#endif /* __Collections_GenericComparer_H__ */
